package com.qian.ddj.web.controller;

import com.qian.api.ddj.model.BusinessCard;
import com.qian.api.ddj.service.IBusinessCardService;
import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ddj/businessCard")
@Api(tags = "商户银行卡管理")
public class BusinessCardController {

    @Autowired
    private IBusinessCardService businessCardService;

    @GetMapping("/{groupId}")
    @ApiOperation("查询银行卡列表")
    public PageResp<BusinessCard> list(PageReq pageReq, @PathVariable Integer groupId) {
        BusinessCard businessCard = new BusinessCard();
        businessCard.setBusinessGroupId(groupId);
        PageResp<BusinessCard> page = businessCardService.findAll(businessCard, pageReq);
        return page;
    }

    @ApiOperation("保存银行卡")
    @PostMapping
    public void save(BusinessCard businessCard) {
        businessCardService.save(businessCard);
    }
}
